<div class="designer">
  <table width="100%">
    <tr>
      <td align="center"><h2><%= designer.full_name %>-<%= t params[:pay_status] %>提成</h2></td>
    </tr>
  </table>
  <table width="100%" >
    <tr>
      <td align="left"></td>
      <td align="right">
        <h3>日期:</h3>
      </td>
      <td width="100"></td>
    </tr>
  </table>
  <table width="100%" cellpadding="3" cellspacing="0"  class="work_items">
    <tr>
      <th>项目</th>
      <th>提成部分</th>
      <th>报酬单位</th>
      <th>计费面积</th>
      <th>工作量</th>
      <th>发放比例</th>
      <th>指导比例</th>
      <th>类型系数</th>
      <th>修改系数</th>
      <th>难度系数</th>
      <th>应得金额</th>
      <th>实得金额</th>
      <th>签名</th>
    </tr>
    <% designer.projects_by_pay_status(params[:pay_status]).each_with_index do |project, project_index| %>
      <% designer.designer_work_items_by(:project_id => project.id, :pay_status => params[:pay_status]).each_with_index do |designer_work_item, index| %>
      <tr>
        <% if  index == 0 %>
          <td align="center" rowspan="<%= designer.designer_work_items_by(:project_id => project.id, :pay_status => params[:pay_status]).size   %>"><%= project.name %></td>
        <% end %>
        <td align="right"><%= designer_work_item.try(:work_item).try(:name) %></td>
        <% if designer_work_item.try(:work_item).try(:allowance?) %>
          <% 8.times.each do  %>
          <td  align="center">--</td>
          <% end %>
        <% else %>
        <td align="right"><%= designer_work_item.try(:work_item).try(:pay_unit) %></td>
        <td align="right"><%= designer_work_item.billing_area %></td>
        <td align="right"><%= designer_work_item.work_load %>  %</td>
        <td align="right"><%= designer_work_item.provided_percent %> %</td>
        <td align="right"><%= designer_work_item.guided_percent %> %</td>
        <td align="right"><%= designer_work_item.type_num %>  %</td>
        <td align="right"><%= designer_work_item.motify_num %>  %</td>
        <td align="right"><%= designer_work_item.difficulty_num %>  %</td>
        <% end %>
        <td align="right"><%= number_with_precision designer_work_item.should_be_payed, :precision => 1 %></td>
        <td></td>
        <% if index == 0 %>
          <td align="center" rowspan="<%= designer.designer_work_items_by(:project_id => project.id, :pay_status => params[:pay_status]).size   %>"></td>
        <% end %>
      </tr>
      <% end %>
    <% end %>
      <tr>
        <td colspan="10">合计:</td>
        <td align="right">
          <%= number_with_precision designer.total_amount_by_pay_status(params[:pay_status]), :precision => 1 %>
        </td>
        <td></td>
        <td></td>
      </tr>
  </table>
  <table width="100%" >
      <tr>
        <td align="left">
          <h3>审批:</h3>
        </td>
        <td align="center">
          <h3>审核:</h3>
        </td>
        <td align="right">
          <h3>制表:</h3>
        </td>
        <td width="100"></td>
      </tr>
    </table>
</div>